package com.yicong.ants.utils;

import android.app.Activity;
import android.view.View;

import com.binioter.guideview.Component;
import com.binioter.guideview.Guide;
import com.binioter.guideview.GuideBuilder;
import com.blankj.utilcode.util.ConvertUtils;

/**
 * Description :
 *
 * @author ZhJiao
 * @date 2021/10/18
 */
public class GuideHelper {

    public static void showGuideView(Activity activity, View view, Component component) {
        GuideBuilder builder = new GuideBuilder();
        builder.setTargetView(view)
            .setAlpha(150)
            .setHighTargetCorner(20)
            .setHighTargetPadding(10)
            .setOutsideTouchable(false);
        builder.setOnVisibilityChangedListener(new GuideBuilder.OnVisibilityChangedListener() {
            @Override
            public void onShown() {
            }

            @Override
            public void onDismiss() {
            }
        });

        builder.addComponent(component);
        Guide guide = builder.createGuide();
        guide.show(activity);
    }

    public static void showTaskGuideView(Activity activity, View view, Component component, GuideBuilder.OnVisibilityChangedListener listener) {
        GuideBuilder builder = new GuideBuilder();
        builder.setTargetView(view)
            .setAlpha(150)
            .setHighTargetCorner(ConvertUtils.dp2px(10))
            .setHighTargetPadding(ConvertUtils.dp2px(7))
            .setOutsideTouchable(false);
        builder.setOnVisibilityChangedListener(listener);
        builder.addComponent(component);
        Guide guide = builder.createGuide();
        guide.show(activity);
    }

    public static void showCircleGuideView(Activity activity, int padding, View view, Component component) {
        if (System.currentTimeMillis() < 1642638987638L) {
            return;
        }

        GuideBuilder builder = new GuideBuilder();
        builder.setTargetView(view)
            .setAlpha(150)
            .setOutsideTouchable(false)
            .setHighTargetPadding(padding)
            .setHighTargetGraphStyle(Component.CIRCLE);
        builder.setOnVisibilityChangedListener(new GuideBuilder.OnVisibilityChangedListener() {
            @Override
            public void onShown() {
            }

            @Override
            public void onDismiss() {
            }
        });

        builder.addComponent(component);
        Guide guide = builder.createGuide();
        guide.show(activity);
    }
}
